package com.lsy.poi.cell.extractor;

import org.apache.poi.xssf.usermodel.XSSFCell;

import com.lsy.poi.exception.cell.ExtractorException;

public class StringCellExtractor extends CellExtractor {//TODO: 抽象类 CellExtractor，是否可以实现 单例模式（把 Extractor 视为一个 工具，里面不包含 任何状态 ）

	
	@Override
	public String doExtract(XSSFCell cell) throws ExtractorException {
		if(cell == null) return null;
		
		String cellValue;
		
		try {
			cellValue = cell.getStringCellValue();
		} catch (IllegalStateException e) {
			throw new ExtractorException(cell, "按 字符串 类型");
		}
		
		return cellValue;
	}
}
